import 'package:flutter_test/flutter_test.dart';
import 'package:umplugin/umplugin.dart';
import 'package:umplugin/umplugin_platform_interface.dart';
import 'package:umplugin/umplugin_method_channel.dart';
import 'package:plugin_platform_interface/plugin_platform_interface.dart';

class MockUmpluginPlatform
    with MockPlatformInterfaceMixin
    implements UmpluginPlatform {

  @override
  Future<String?> getPlatformVersion() => Future.value('42');
}

void main() {
  final UmpluginPlatform initialPlatform = UmpluginPlatform.instance;

  test('$MethodChannelUmplugin is the default instance', () {
    expect(initialPlatform, isInstanceOf<MethodChannelUmplugin>());
  });

  test('getPlatformVersion', () async {
    Umplugin umpluginPlugin = Umplugin();
    MockUmpluginPlatform fakePlatform = MockUmpluginPlatform();
    UmpluginPlatform.instance = fakePlatform;

    expect(await umpluginPlugin.getPlatformVersion(), '42');
  });
}
